package nickthissen.iracing.parsing;

import org.jsoup.nodes.Node;


// Predicate to filter a list of Nodes to return only those that are instances of a list of node types
// (element, textnode, ...)
public class FilterNodeTypePredicate implements Predicate<Node>
{
	private Class<?>[] classes;

    public FilterNodeTypePredicate(Class<?>... c)
    {
        this.classes = c;
    }

	@Override
	public boolean apply(Node in) 
	{
		// Check if the node is an instance of any of the classes to check against
		for (Class<?> c : classes)
		{
			if (in.getClass().isInstance(c)) return true;
		}
		return false;
	}
}

